package com.aaa.day1104.demo1;

import java.util.function.Consumer;

/**
 * @Description:
 * @author:LiWei
 * @date:2022年11月04日9:33
 */
public class Test {
    public static void main(String[] args) {

//        Consumer<int[]>consumer=(arr)->{
//            Test.sum(arr);
//        };

        Consumer<int[]>consumer=Test::sum;

        int[]arr={3,14,56,4,12};
        consumer.accept(arr);
    }
    public static void sum(int[]arr){
        int sum=0;
        for (int a:arr) {
            sum+=a;
        }
        System.out.println("sum = " + sum);
    }
}
